
{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('region', array('op' => 'display'))}">小区管理</a></li>
	<!-- <li {if $op == 'manage'}class="active"{/if}><a href="{php echo $this->createWebUrl('region', array('op' => 'manage'))}">小区信息</a></li> -->
</ul>
{if $op == 'display'}
<div class="main">
<div style="margin:0;" class="alert alert-info"><i class="icon-warning-sign"></i>&nbsp;物业公司下可添加多个小区，用户注册时需要选择绑定到哪个小区中。</div>
	<form class="form-horizontal form" action="" method="post" onsubmit="return formcheck(this)">
		<input name="weid" type="hidden" value="{$weid}">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th style='width:150px;'>名称<i></i></th>
					<th style='width:100px;'>联系人<i></i></th>
					<th style='width:150px;'>电话<i></i></th>
					<th class="row-hover" style="min-width:850px;">常用操作</th>
					<th class="row-hover span1" style="text-align:right;width:60px;">操作</th>
				</tr>
			</thead>
			<tbody id="status-items">
			{loop $regions $region}
				<tr>
					<td><input class="form-control" name="titles[]" type="text" value="{$region['title']}"></td>
					<td><input class="form-control" name="linkmen[]" type="text" value="{$region['linkmen']}">
						<input name="ids[]" type="hidden" value="{$region['id']}"></td>
					<td><input class="form-control" name="linkways[]" type="text" value="{$region['linkway']}"></td>
					<td>
						<a href="{php echo $this->createWebUrl('repair', array('op' => 'display', 'regionid'=>$region['id']));}">报修管理</a>
						|
						<a href="{php echo $this->createWebUrl('report', array('op' => 'display', 'regionid'=>$region['id']));}">投诉管理</a>
						|
						<a href="{php echo $this->createWebUrl('member', array('op' => 'display', 'regionid'=>$region['id']));}">业主管理</a>
						|
						<a href="{php echo $this->createWebUrl('announcement', array('op' => 'display', 'regionid'=>$region['id']));}">公告管理</a>
						|
						<a href="{php echo $this->createWebUrl('homemaking', array('op' => 'display', 'regionid'=>$region['id']));}">家政服务</a>
						|
						<a href="{php echo $this->createWebUrl('houselease', array('op' => 'display', 'regionid'=>$region['id']));}">房屋租赁</a>
						|
						<a href="{php echo $this->createWebUrl('notice', array('op' => 'display', 'regionid'=>$region['id']));}">通知设置</a>
						
					</td>
					<td style="text-align:right;" class="span1">
					<a onclick="if (confirm('删除操作不可恢复，确认吗？')){ $(this).parent().parent().next().remove(); return true;} else {return false;}" href="{php echo $this->createWebUrl('region', array('op' => 'delete', 'id' => $region['id']))}" class="btn btn-default btn-sm" data-original-title="删除"><i class="fa fa-times"></i></a>
					
					</td>
				</tr>
			{/loop}
			</tbody>
			<tr>
				<td colspan="5">
					<a href="javascript:;" onclick="addStatusItem()"><i class="icon-plus-sign-alt"></i> 添加新小区</a>
				</td>
			</tr>
		</table>
		<table class="tb">
			<tr>
				<td colspan="6">
					<button type="submit" class="btn btn-primary span3" name="submit" value="提交">提交</button>
					<input type="hidden" name="token" value="{$_W['token']}" />
				</td>
			</tr>
		</table>
	</form>
</div>
<script type="text/javascript">

	function addStatusItem() {
		var html = '' +
				'<tr>' +
					'<td><input class="form-control" name="titles[]" title="小区名称" placeholder="小区名称" type="text" value=""/></td>' +
					'<td><input class="form-control" name="linkmen[]" title="联系人姓名" placeholder="联系人姓名" type="text" value=""/><input name="ids[]" type="hidden" value=""/></td>' +
					'<td><input class="form-control" name="linkways[]" title="联系人电话" placeholder="联系人电话" type="text" value=""></td>' +
					'<td></td>' +
					'<td style="text-align:right;"><a href="javascript:;" onclick="$(this).parent().parent().remove();" class="btn btn-small" title="删除此条目"><i class="icon-remove"></i></a></td>' +
				'</tr>';
		$('#status-items').append(html);
	}

</script>
{elseif $op == 'manage'}
{template 'nav'}
<div class="main">
	<div style="padding:15px 15px 0 15px;">
		<div class="welcome">
			<h4><i class="icon-user"></i> 小区信息</h4>
			<div class="item">
				<div class="pull-left">
					<p><b style="font-size:16px;">{$region['title']}</b></p>
					<p><span style="width:80px;display:inline-block;">联系人：</span>{$region['linkman']}</p>
					<p><span style="width:80px;display:inline-block;">联系电话：</span>{$region['linkway']}</p>
				</div>
			</div>
			<h4><i class="icon-plane"></i> 快捷操作</h4>
			<div class="item fast-set">
				<a href=""><div class="fast-icon img-rounded"><i class="icon-bullhorn"></i></div><span>公告管理</span></a>
				<a href=""><div class="fast-icon img-rounded"><i class="icon-wrench"></i></div><span>报修管理</span></a>
				<a href=""><div class="fast-icon img-rounded"><i class="icon-user"></i></div><span>业主管理</span></a>
				<a href=""><div class="fast-icon img-rounded"><i class="icon-legal"></i></div><span>投诉管理</span></a>
<!-- 				<a href=""><div class="fast-icon img-rounded"><i class="icon-phone"></i></div><span>常用电话管理</span></a>
 -->			</div>
		</div>
		<table class="table">
			<tr><th colspan="2" class="alert alert-info">待办事项</th></tr>
			{if $repaircount}
			<tr>
				<th style="width:250px;">报修待处理事项</th>
				<td>{$repaircount}&nbsp;&nbsp;<a href="{php echo $this->createWebUrl('repair', array('op' => 'display', 'regionid' => $id, 'status[]' => 0))}">查看</a></td>
			</tr>
			{/if}
			{if $reportcount}
			<tr>
				<th style="width:250px;">投诉待处理事项</th>
				<td>{$reportcount}&nbsp;&nbsp;<a href="{php echo $this->createWebUrl('report', array('op' => 'display', 'regionid' => $id, 'status[]' => 0))}">查看</a></td>
			</tr>
			{/if}
		</table>
		<table class="table">
			<tr>
				<th colspan="4" class="alert alert-info">待办回复留言</th>
			</tr>
			<tr>
				<th style="width:250px;">类型</th>
				<td>内容</td>
				<td>最新留言</td>
				<th>&nbsp;</th>
			</tr>
			{loop $reply $row}
			<tr>
				<td>{$row['category']}</td>
				<td>{$row['content']}</td>
				<td>{$row['message']['content']}</td>
				<td><a href="{php echo $this->createWebUrl('repair', array('op' => 'post', 'id' => $row['id'], 'regionid' => $id, 'status[]' => 0))}">回复</a></td>
			</tr>
			{/loop}
		</table>
	</div>
</div>
{/if}
{template 'common/footer'}